In a semiconductor device, other than a main power supply circuit, a sub-power supply circuit is provided. The sub-power supply circuit operates when the main power supply circuit is turned off, and power consumption in the sub-power supply circuit is lower than that in the main power supply circuit. As such a sub-power supply circuit, a constant voltage circuit that is simply configured is suggested.